package com.jsz.peini.common.util;

import java.util.Date;
import java.util.UUID;

import com.jsz.peini.bean.user.UserSms;
import com.jsz.peini.mapper.user.UserSmsMapper;

/**
 * @author Han Guohong
 * @version 2017-4-28 上午11:35:51
 * 类说明
 */
public class SmsSendUtil {
	
	/**
	 * 发送通知消息
	 * @author Han Guohong
	 * @param toid
	 * @param paramid
	 * @param smstype
	 * @param smscontent
	 */
	public static void sendSmsNotify(String toid, String paramid,
			Integer smstype, String smscontent){
		
		UserSmsMapper userSmsMapper = (UserSmsMapper)SpringContextUtil.getBean(UserSmsMapper.class);
		
		UserSms sms = new UserSms(null,toid, paramid, smstype, smscontent);
		
		sms.setSmsid(UUID.randomUUID().toString().replace("-", ""));
		sms.setIsremind(1);
		sms.setReceivdel(0);
		sms.setSenddel(0);
		sms.setSendtime(new Date());
		
		userSmsMapper.insertSelective(sms);
	}
	
	public static void sendSmsNotify(String fromId,String toid, String paramid,
			Integer smstype, String smscontent){
		
		UserSmsMapper userSmsMapper = (UserSmsMapper)SpringContextUtil.getBean(UserSmsMapper.class);
		
		UserSms sms = new UserSms(fromId,toid, paramid, smstype, smscontent);
		
		sms.setSmsid(UUID.randomUUID().toString().replace("-", ""));
		sms.setIsremind(1);
		sms.setReceivdel(0);
		sms.setSenddel(0);
		sms.setSendtime(new Date());
		
		userSmsMapper.insertSelective(sms);
	}
	
	/**
	 * 发送小秘书消息
	 * @author Han Guohong
	 * @param fromid
	 * @param toid
	 * @param paramid
	 * @param smstype
	 * @param smscontent
	 */
	public static void sendSmsFit(String fromid, String toid, String paramid,
			Integer smstype, String smscontent){
		
		UserSmsMapper userSmsMapper = (UserSmsMapper)SpringContextUtil.getBean(UserSmsMapper.class);
		
		UserSms sms = new UserSms(fromid, toid, paramid, smstype, smscontent);
		
		sms.setSmsid(UUID.randomUUID().toString().replace("-", ""));
		sms.setIsremind(1);
		sms.setReceivdel(0);
		sms.setSenddel(0);
		sms.setSendtime(new Date());
		
		userSmsMapper.insertSelective(sms);
	}
}
